#include<stdio.h> 
#include<bits/stdc++.h> 
using namespace std;
const int N=200005;
int n,a[N],b[N],v[N];
int find(int x){
	if(b[x]!=x)b[x]=find(b[x]);
	return b[x];
}
int main(){
//	freopen("fruit.in","r",stdin);
//	freopen("fruit.out","w",stdout);
	cin>>n;
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		v[i]=0;
	}
	int sum=n;
	while(sum){
		int x=-1;
		for(int i=1;i<=n;i++){
			if(v[i]==0){
				if(x==-1){
					printf("%d ",i);
					x=a[i];
					v[i]=1;
					sum--;
				}
				if(a[i]!=x){
					printf("%d ",i);
					x=a[i];
					v[i]=1;
					sum--;
				}
			}
		}printf("\n");
	}
	
	return 0;
}
